const fs = require('fs');

const process = require('process')//测试内存占用
// 同步写入
// const data = fs.readFileSync('../视频/1.mp4');
//
// fs.writeFileSync('../视频/2.mp4',data);
// console.log(process.memoryUsage()); //34MB
//流式写入
const rs = fs.createReadStream('../视频/1.mp4');

const ws = fs.createWriteStream('../视频/3.mp4');

rs.on('data', chunk => {
    ws.write(chunk);
});

rs.on('end',() => {
    console.log(process.memoryUsage())
});
